diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2010-11-03 19:14:59 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2010-11-03 19:14:59 +1100 |
| commit | d36572df472f35191d9b8a3fbc89ad18663b0f29 (patch) | |
| tree | 8f3feef9dd4f51a2e313129dbc66b19c4e37444d /inc | |
| parent | 135ef83876c85bb2f43c244f3115a8ab2464a3b0 (diff) | |
Fixed page numbers.
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/functions.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/inc/functions.php b/inc/functions.php index 911c1bc4..0cf78aa9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -62,12 +62,12 @@ $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); - $count = floor($arr['num'] / THREADS_PER_PAGE); + $count = floor((THREADS_PER_PAGE + $arr['num'] - 1) / (THREADS_PER_PAGE)); $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)); - } + } mysql_free_result($res); unset($arr); |
