logs_pagination.phtml 2.1 KB

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