In 6.5, but I think also in previous versions if there are posts in a topic from users which are no longer in the database, the posts are not displayed.
Yet the number of pages of a topic is calculated with the total number of posts.
The result is that sometimes for instance a topic has 5 pages,
but when you click on the 5th page, the page is empty.
This happens because of a too restricitve query used.
In showflat.php
this query:
$query = "<br /> SELECT t1.B_Number,t2.U_Username,t1.B_Posted,t1.B_IP,t1.B_Subject,.........<br /> FROM {$config['tbprefix']}Posts AS t1,<br /> {$config['tbprefix']}Users AS t2<br /> WHERE t1.B_Main = $current<br /> AND t1.B_PosterId = t2.U_Number<br /> $Viewable<br /> ORDER BY B_Number<br /> $Limit<br />";
should be:
$query = "<br /> SELECT t1.B_Number,t2.U_Username,t1.B_Posted,t1.B_IP,t1.B_Subject,.........<br /> FROM {$config['tbprefix']}Posts AS t1<br /> LEFT JOIN {$config['tbprefix']}Users AS t2 ON t1.B_PosterId = t2.U_Number<br /> WHERE t1.B_Main = $current<br /> $Viewable<br /> ORDER BY B_Number<br /> $Limit<br />";
also the way how the number of pages is calculated is unnecessarily complicated.
this:
$length = $length - 1;<br />$pages = $length / $Totaldisplay;<br />if (is_int($pages)) {<br /> $pages++;<br />}<br />$pages = ceil($pages);
can be replaced by:
$pages = ceil($length / $Totaldisplay);