Improve pagination logic when no page is given