logs_pagination.phtml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $c = Minz_Request::controllerName();
  5. $a = Minz_Request::actionName();
  6. $params = array_filter($_GET, 'is_string', ARRAY_FILTER_USE_KEY);
  7. ?>
  8. <?php if ($this->nbPage > 1) { ?>
  9. <nav class="nav-pagination nav-list">
  10. <ul class="pagination">
  11. <?php
  12. /** @var string $getteur from Minz_Paginator::render() */
  13. $params[$getteur] = 1;
  14. ?>
  15. <li class="item pager-first">
  16. <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>">« <?= _t('conf.logs.pagination.first') ?></a>
  17. </li>
  18. <?php $params[$getteur] = $this->currentPage - 1; ?>
  19. <li class="item pager-previous">
  20. <?php if ($this->currentPage > 1) { ?>
  21. <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>">‹ <?= _t('conf.logs.pagination.previous') ?></a>
  22. <?php } ?>
  23. </li>
  24. <?php if ($this->currentPage - 2 > 1) { ?>
  25. <li class="item">…</a></li>
  26. <?php } ?>
  27. <?php
  28. for ($i = $this->currentPage - 2; $i <= $this->currentPage + 2; $i++) {
  29. if ($i > 0 && $i <= $this->nbPage) {
  30. $params[$getteur] = $i;
  31. if ($i != $this->currentPage) {
  32. $class = '';
  33. $aria = 'false';
  34. } else {
  35. $class = ' active';
  36. $aria = 'true';
  37. } ?>
  38. <li class="item<?= $class ?>"><a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>" aria-current="<?= $aria ?>"><?= $i ?></a></li>
  39. <?php
  40. }
  41. } ?>
  42. <?php if ($this->nbPage > $this->currentPage + 2) { ?>
  43. <li class="item">…</a></li>
  44. <?php } ?>
  45. <?php $params[$getteur] = $this->currentPage + 1; ?>
  46. <li class="item pager-next">
  47. <?php if ($this->currentPage < $this->nbPage) { ?>
  48. <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>"><?= _t('conf.logs.pagination.next') ?> ›</a>
  49. <?php } ?>
  50. </li>
  51. <?php $params[$getteur] = $this->nbPage; ?>
  52. <li class="item pager-last">
  53. <a href="<?= Minz_Url::display(['c' => $c, 'a' => $a, 'params' => $params]) ?>"><?= _t('conf.logs.pagination.last') ?> »</a>
  54. </li>
  55. </ul>
  56. </nav>
  57. <?php } ?>