Skip to content

Commit c19e8ca

Browse files
authored
Merge pull request #1 from atharalipk/master
page number should be positive
2 parents fcee939 + 63cbd89 commit c19e8ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pagination.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct($max, $total, $page = 1, $max_items = 10)
2222
$this->max_items = $max_items;
2323

2424
# Set the page as a number, bypassing GET
25-
$this->page = (!empty($page) && ($page <= $this->pages()) && is_numeric($page)) ? $page : 1;
25+
$this->page = (!empty($page) && ($page <= $this->pages()) && is_numeric($page) && $page>0 ) ? $page : 1;
2626
}
2727

2828
/**
@@ -56,7 +56,7 @@ public function get_html($theme_file=null)
5656
public function start()
5757
{
5858
# Computers Calculate From 0 thus, page1 must start results from 0
59-
$start = $this->page - 1;
59+
$start = abs($this->page - 1);
6060

6161
# Calculate Our Starting Point (0x6=0(start from 0, page1), 1x6=6(start from 6, page2), etc)
6262
$calc = $start*$this->max;

0 commit comments

Comments
 (0)