I believe a bug was fixed, do you have the most up to date version, check the issues on this.
Laravel 5.2 - over the range pagination numbers in URL producing a blank page
I did a good search before posting - but cannot figure out a way to prevent users from manually inputting page numbers in the URL of the paginator (a number over that range producing a blank page).
For example page 2 would have the following link: http://localhost/articles?page=2 If I have a maximum of 3 pages, and manually changing 2 into 5 within the URL, this will be redirecting to a blank page.
Not the end of the world, but surely annoying. I have looked at my options:
1 - Using isEmpty in the controller, after the paginator is called:
if ($articles->isEmpty()) {
return App::abort(404);
}
This seemed to work fine at first (in terms of over the range pagination). But then I have discovered that when there are no articles, a 404 is thrown in my index page, which was not my intention.
2 - Use Ajax pagination, where there is no page number in the URI (ex. http://localhost/articles). This also requires a javaScript paginator, and I will not be able to use Laravel's. With Laravel, I am using simplePaginate, and could not find a similar one in javaScript (all I have found were full-blown, long paginators).
Any pointers on this?
Please or to participate in this conversation.