Skip to content

Commit

Permalink
page number should be positive
Browse files Browse the repository at this point in the history
Signed-off-by: atharalipk <[email protected]>
  • Loading branch information
atharalipk committed Dec 12, 2022
1 parent fcee939 commit 63cbd89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 63cbd89

Please sign in to comment.