🐛 Fix pagination on new listings

Fixes #83
This commit is contained in:
Kazhnuz 2025-08-22 23:43:57 +02:00
parent fae2fe7d42
commit 3eaca33170
4 changed files with 17 additions and 2 deletions

View file

@ -18,7 +18,7 @@ class Archives extends dbList {
$db = $pages->getDB($onlyKeys=false);
$archiveIndex = array();
foreach ($db as $pageKey=>$pageFields) {
if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES'])) {
if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_AUTHOR_ARCHIVE'])) {
$date = $pageFields['date'];
$year = mb_substr($date, 0, 4);
$month = mb_substr($date, 0, 7);

View file

@ -18,7 +18,7 @@ class Authors extends dbList {
$db = $pages->getDB($onlyKeys=false);
$authorsIndex = array();
foreach ($db as $pageKey=>$pageFields) {
if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES'])) {
if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_AUTHOR_ARCHIVE'])) {
$authorName = $pageFields['username'];
if (isset($authorsIndex[$authorName])) {
array_push($authorsIndex[$authorName]['list'], $pageKey);

View file

@ -15,6 +15,18 @@ if ($url->whereAmI()=='admin') {
$itemsPerPage = $site->itemsPerPage();
$categoryKey = $url->slug();
$numberOfItems = $categories->numberOfPages($categoryKey);
} elseif ($url->whereAmI()=='author') {
$itemsPerPage = $site->itemsPerPage();
$categoryKey = $url->slug();
$numberOfItems = $authors->numberOfPages($categoryKey);
} elseif ($url->whereAmI()=='archive') {
$itemsPerPage = $site->itemsPerPage();
$categoryKey = $url->slug();
$numberOfItems = $archives->numberOfPages($categoryKey);
} elseif ($url->whereAmI()=='kind') {
$itemsPerPage = $site->itemsPerPage();
$categoryKey = $url->slug();
$numberOfItems = $kinds->numberOfPages($categoryKey);
} else {
$itemsPerPage = $site->itemsPerPage();
$numberOfItems = $pages->count(true);

View file

@ -106,6 +106,9 @@ define('MEDIA_MANAGER_SORT_BY_DATE', true);
// Type of pages included in the tag database
$GLOBALS['DB_TAGS_TYPES'] = array('published','static','sticky');
// Type of pages included in the author/archive database
$GLOBALS['DB_TAGS_AUTHOR_ARCHIVE'] = array('published','sticky');
// Allowed image extensions
$GLOBALS['ALLOWED_IMG_EXTENSION'] = array('gif', 'png', 'jpg', 'jpeg', 'svg', 'webp');