Skip to content

Commit

Permalink
cast total_pages to int, rename view variable page to `current_page…
Browse files Browse the repository at this point in the history
…_number`
  • Loading branch information
creme332 committed May 18, 2024
1 parent c0b535a commit 03b27f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/Shop.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public function index(): void
$this->data['categories'] = Product::getCategories();
$this->data['sort_option'] = $_GET['sort'] ?? "";
$this->data['selected_categories'] = $_GET['categories'] ?? [];
$this->data['page'] = $this->getPageNumber();
$this->data['totalPages'] = ceil(count($filtered_products) / Shop::$MAX_PRODUCTS_PER_PAGE);
$this->data['current_page_number'] = $this->getPageNumber();
$this->data['total_pages'] = (int)ceil(count($filtered_products) / Shop::$MAX_PRODUCTS_PER_PAGE);

// Render the view with pagination information
$this->view(
Expand Down

0 comments on commit 03b27f6

Please sign in to comment.