-
-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1551 - Redirect to the last page when current page is out of range #1700
Conversation
delyriand
commented
Feb 19, 2016
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Documentation | no |
Translation | no |
Fixed tickets | #1551 |
License | MIT |
$entries->setCurrentPage($page); | ||
} catch (OutOfRangeCurrentPageException $e) { | ||
if ($page > 1) { | ||
return $this->redirect(str_replace('/' . $page, '/' . $entries->getNbPages(), $request->getRequestUri()), 301); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rather do:
return $this->redirect($this->generateUrl($type, array('page' => $entries->getNbPages())));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you!
97e8010
to
4d85a87
Compare
$entries->setCurrentPage($page); | ||
} catch (OutOfRangeCurrentPageException $e) { | ||
if ($page > 1) { | ||
return $this->redirect($this->generateUrl($type, array('page' => $entries->getNbPages())), 301); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could you put a 302
instead? You don't know if in the future you'll have the given page :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed ... in my mind, I wanted to make a temporary redirect :)
4d85a87
to
671a2b8
Compare
Thanks ! 👍 |
Fix #1551 - Redirect to the last page when current page is out of range