Hundred Page Limit

Sort:
artfizz
artfizz wrote:

The newly introduced 100-page limit on threads seems to have had some unintended consequences. If you do a search and the result is greater than 100 pages, you cannot see the end of the search.

This applies to lists of Groups, Topics, Members, etc.

For groups, where you are sorting by number of members, it means you cannot display any groups with fewer than 23 members.

For topics, you can see back beyond last October.


artfizz wrote: For groups, where you are sorting by number of members, it means you cannot display any groups with fewer than 44 members.

For topics, you cannot see back beyond 2½  months ago.


Now you can't see any groups with fewer than 60 members in the search list.

artfizz
artfizz wrote:
artfizz wrote:

The newly introduced 100-page limit on threads seems to have had some unintended consequences. If you do a search and the result is greater than 100 pages, you cannot see the end of the search.

This applies to lists of Groups, Topics, Members, etc.

For groups, where you are sorting by number of members, it means you cannot display any groups with fewer than 23 members.

For topics, you can see back beyond last October.


artfizz wrote: For groups, where you are sorting by number of members, it means you cannot display any groups with fewer than 44 members.

For topics, you cannot see back beyond 2½  months ago.


Now you can't see any groups with fewer than 60 members in the search list.

Now you can't see any groups with fewer than 74 members.

deandyu
artfizz wrote:
artfizz wrote:
artfizz wrote:

The newly introduced 100-page limit on threads seems to have had some unintended consequences. If you do a search and the result is greater than 100 pages, you cannot see the end of the search.

This applies to lists of Groups, Topics, Members, etc.

For groups, where you are sorting by number of members, it means you cannot display any groups with fewer than 23 members.

For topics, you can see back beyond last October.


artfizz wrote: For groups, where you are sorting by number of members, it means you cannot display any groups with fewer than 44 members.

For topics, you cannot see back beyond 2½  months ago.


Now you can't see any groups with fewer than 60 members in the search list.

Now you can't see any groups with fewer than 74 members.


Now you can see any groups  with fewer than 122 members.

artfizz
deandyu wrote:


Now you can see any groups  with fewer than 122 members.

Keep your group small to stay under the radar!

Benzodiazepine
erik wrote:

the simple fact is, it's really painful on the server :) google something... you can't just infinitely "next" through the results (google gives me 92 pages for "chess"). a better approach is to try and find out what you are actually trying to find/do and we can attempt to solve that without intensive pagination... so, what is it? :D

Hey Erik. I'm a web-dev, so I know my stuff or at least I think I do.

Pagination - is not necessarily painful on the server! I know you guys use PHP. In the following I'm going to assume you're using MySQL as your database.

A common approach on pagination is building a SQL query from PHP like:

$page = 3;
$number_of_posts_per_page = 20;
$thread_id = 123;

$offset = $number_of_posts_per_page * $page;
$sql = "SELECT *

       FROM `posts`
       WHERE `thread_id` = $thread_id
       ORDER BY `id` ASC
       LIMIT $offset, $number_of_posts_per_page";

This gives you all the posts on page 3 (with 20 posts per page) that belong to the thread with the id=123. Obviously this will give you at most 20 rows. If the thread has less than 60 posts (less than 3 full pages), say 57 posts then you will get 17 rows.

But, now you'll need another query without the LIMIT clause to determine the actual number of posts there is to build your pagination, so you will do:

  
$sql = "SELECT COUNT(*) FROM `posts`
        WHERE `thread_id` = $thread_id";

Now you have the actual number of posts the thead contains. Dividing it by $number_of_posts_per_page (20 from above) you get the number of pages the thread has.

However, this last COUNT(*) query is what gives the server pain.

There's an easy remedy for that in MySQL it's called FOUND_ROWS()
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows

Here's a small exert:

A SELECT statement may include a LIMIT clause to restrict the number of rows the server returns to the client. In some cases, it is desirable to know how many rows the statement would have returned without the LIMIT, but without running the statement again. To obtain this row count, include a SQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke FOUND_ROWS() afterward

This means that all you have to do is change the first query to:

 $sql = "SELECT SQL_CALC_FOUND_ROWS *
         FROM `posts`
         WHERE `thread_id` = $thread_id
         ORDER BY `id` ASC
         LIMIT $offset, $number_of_posts_per_page";

MySQL will now remember/cache the number of posts the thread has. Without you having to run the above COUNT(*) query again. To get the number of posts you just have to do:

 $sql = "SELECT FOUND_ROWS()"; 

instead. And divide through your number of posts per page to know how many pages there is.

Rayyan_Layth

5 years ago !

And still the same problem Yell

upen2002

Still the same problem!