From 03b27f65a8e91e3a36bc5938d287e08018dd0c16 Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Sat, 18 May 2024 17:53:14 +0400 Subject: [PATCH] cast total_pages to int, rename view variable `page` to `current_page_number` --- src/controllers/Shop.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/Shop.php b/src/controllers/Shop.php index fc652e6..a582450 100644 --- a/src/controllers/Shop.php +++ b/src/controllers/Shop.php @@ -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(