Don't allow requesting an archive page that doesn't exist
Cherry picked from master branch. Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
3bf067c6ea
commit
6accc81ad6
@ -1,6 +1,9 @@
|
||||
Version 2.3.3-beta1 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Don't allow requesting an archive page that doesn't exist.
|
||||
Thanks to @lotharsm!
|
||||
|
||||
* Fix: Set action to empty in functions_routing.php when serving JS;
|
||||
otherisw the default page has been generated at every call.
|
||||
|
||||
|
@ -404,10 +404,18 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
|
||||
|
||||
if (!empty($limit)) {
|
||||
if (isset($serendipity['GET']['page']) && ($serendipity['GET']['page'] > 1 || serendipity_db_bool($serendipity['archiveSortStable'])) && !strstr($limit, ',')) {
|
||||
if (serendipity_db_bool($serendipity['archiveSortStable'])) {
|
||||
$totalEntries = serendipity_getTotalEntries();
|
||||
|
||||
$totalEntries = serendipity_getTotalEntries();
|
||||
$totalPages = ceil($totalEntries / $limit);
|
||||
|
||||
// Do not allow requesting a page that doesn't exist
|
||||
// and do a fallback to the highest page number available
|
||||
if ($serendipity['GET']['page'] > $totalPages) {
|
||||
$serendipity['GET']['page'] = $totalPages;
|
||||
}
|
||||
|
||||
if (serendipity_db_bool($serendipity['archiveSortStable'])) {
|
||||
|
||||
$totalPages = ceil($totalEntries / $limit);
|
||||
if ($totalPages <= 0 ) {
|
||||
$totalPages = 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user