From 63cbd89405a75694b193967b67461f5e893fba4c Mon Sep 17 00:00:00 2001 From: atharalipk Date: Mon, 12 Dec 2022 23:41:33 +0500 Subject: [PATCH] page number should be positive Signed-off-by: atharalipk --- pagination.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pagination.php b/pagination.php index 1c6e653..cf30e07 100644 --- a/pagination.php +++ b/pagination.php @@ -22,7 +22,7 @@ public function __construct($max, $total, $page = 1, $max_items = 10) $this->max_items = $max_items; # Set the page as a number, bypassing GET - $this->page = (!empty($page) && ($page <= $this->pages()) && is_numeric($page)) ? $page : 1; + $this->page = (!empty($page) && ($page <= $this->pages()) && is_numeric($page) && $page>0 ) ? $page : 1; } /** @@ -56,7 +56,7 @@ public function get_html($theme_file=null) public function start() { # Computers Calculate From 0 thus, page1 must start results from 0 - $start = $this->page - 1; + $start = abs($this->page - 1); # Calculate Our Starting Point (0x6=0(start from 0, page1), 1x6=6(start from 6, page2), etc) $calc = $start*$this->max;