Skip to content

Commit

Permalink
Merge pull request #1 from atharalipk/master
Browse files Browse the repository at this point in the history
page number should be positive
  • Loading branch information
ISTPdev authored Aug 22, 2023
2 parents fcee939 + 63cbd89 commit c19e8ca
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 c19e8ca

Please sign in to comment.