laravel/framework — pull request #2052 by jasonlfunk (2013-08-07 18:53:56+00:00)
Title: Update the query builder to get the last page of results if the requested page is beyond the last page.

Update the query builder to get the last page of results if the requested page is beyond the last page.

The paginator has code to make sure that a page isn't requested beyond what is available, this ensures that methods such as links() do not go crazy and show links for pages that don't exist. This is sensible but the query builder doesn't do anything similar. If the user requests page 4 when there are only 3 pages, the links will show that we are displaying page 3 (it's bolded) but there will be no results present. This patch ensures that the last page of results are shown if a page beyond what exists is requested.