includes/modules/pagination.php
<?php
$baseParams = dashboardPaginationParams(
$view,
$day,
$week,
$month,
$year,
['site' => $currentSite]
);
?>
<nav class="pagination">
<?php if ($topPageNum > 1): ?>
<a href="?<?= h($baseParams) ?>&per=<?= $topPerPage ?>&tp=<?= $topPageNum - 1 ?>"><?= icon('previous') ?> <?= h(t('ui.pagination.previous')) ?></a>
<?php endif; ?>
<?php
$pages = range(
max(1, $topPageNum - 2),
min($topLastPage, $topPageNum + 2)
);
?>
<?php if (!in_array(1, $pages, true)): ?>
<a href="?<?= h($baseParams) ?>&per=<?= $topPerPage ?>&tp=1">1</a>
<?php if ($pages[0] > 2): ?><span>…</span><?php endif; ?>
<?php endif; ?>
<?php foreach ($pages as $p): ?>
<?php if ($p === $topPageNum): ?>
<strong><?= h($p) ?></strong>
<?php else: ?>
<a href="?<?= h($baseParams) ?>&per=<?= $topPerPage ?>&tp=<?= $p ?>"><?= h($p) ?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php if (!in_array($topLastPage, $pages, true)): ?>
<?php if (end($pages) < $topLastPage - 1): ?><span>…</span><?php endif; ?>
<a href="?<?= h($baseParams) ?>&per=<?= $topPerPage ?>&tp=<?= $topLastPage ?>"><?= h($topLastPage) ?></a>
<?php endif; ?>
<?php if ($topPageNum < $topLastPage): ?>
<a href="?<?= h($baseParams) ?>&per=<?= $topPerPage ?>&tp=<?= $topPageNum + 1 ?>"><?= h(t('ui.pagination.next')) ?> <?= icon('next') ?></a>
<?php endif; ?>
</nav>