[ticket/12613] Improved pagination

PHPBB3-12613