Fixed page numbers.
This commit is contained in:
parent
135ef83876
commit
d36572df47
@ -62,10 +62,10 @@
|
|||||||
|
|
||||||
$res = mysql_query("SELECT COUNT(`id`) as `num` FROM `posts` WHERE `thread` IS NULL", $sql) or error(mysql_error($sql));
|
$res = mysql_query("SELECT COUNT(`id`) as `num` FROM `posts` WHERE `thread` IS NULL", $sql) or error(mysql_error($sql));
|
||||||
$arr = mysql_fetch_array($res);
|
$arr = mysql_fetch_array($res);
|
||||||
$count = floor($arr['num'] / THREADS_PER_PAGE);
|
$count = floor((THREADS_PER_PAGE + $arr['num'] - 1) / (THREADS_PER_PAGE));
|
||||||
|
|
||||||
$pages = Array();
|
$pages = Array();
|
||||||
for($x=0;$x<=$count && $x<=MAX_PAGES;$x++) {
|
for($x=0;$x<$count && $x<MAX_PAGES;$x++) {
|
||||||
$pages[] = Array('num' => $x+1, 'link' => $x==0 ? ROOT . FILE_INDEX : ROOT . sprintf(FILE_PAGE, $x+1));
|
$pages[] = Array('num' => $x+1, 'link' => $x==0 ? ROOT . FILE_INDEX : ROOT . sprintf(FILE_PAGE, $x+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user