mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-25 00:35:40 -04:00
Fix: logs page=0 error (#4460)
* add docs of function param()
* page < 0 is impossible now
* show prev/next only, when there is a prev/next page
* set always page params
* Revert "page < 0 is impossible now"
This reverts commit fdb920ee50.
* Update logs_pagination.phtml
This commit is contained in:
@@ -371,7 +371,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
|
||||
$logs = FreshRSS_LogDAO::lines(); //TODO: ask only the necessary lines
|
||||
|
||||
//gestion pagination
|
||||
$page = Minz_Request::param('page', 1);
|
||||
$page = intval(Minz_Request::param('page', 1));
|
||||
$this->view->logsPaginator = new Minz_Paginator($logs);
|
||||
$this->view->logsPaginator->_nbItemsPerPage(50);
|
||||
$this->view->logsPaginator->_currentPage($page);
|
||||
|
||||
@@ -17,9 +17,14 @@
|
||||
</li>
|
||||
|
||||
<?php $params[$getteur] = $this->currentPage - 1; ?>
|
||||
|
||||
|
||||
<li class="item pager-previous">
|
||||
<?php if ($this->currentPage > 1) { ?>
|
||||
<a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>">‹ <?= _t('conf.logs.pagination.previous') ?></a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
|
||||
|
||||
<?php if ($this->currentPage - 2 > 1) { ?>
|
||||
<li class="item">…</a></li>
|
||||
@@ -28,8 +33,8 @@
|
||||
<?php
|
||||
for ($i = $this->currentPage - 2; $i <= $this->currentPage + 2; $i++) {
|
||||
if($i > 0 && $i <= $this->nbPage) {
|
||||
$params[$getteur] = $i;
|
||||
if ($i != $this->currentPage) {
|
||||
$params[$getteur] = $i;
|
||||
$class = '';
|
||||
$aria = 'false';
|
||||
} else {
|
||||
@@ -46,9 +51,13 @@
|
||||
<?php } ?>
|
||||
|
||||
<?php $params[$getteur] = $this->currentPage + 1; ?>
|
||||
|
||||
<li class="item pager-next">
|
||||
<?php if ($this->currentPage < $this->nbPage) { ?>
|
||||
<a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>"><?= _t('conf.logs.pagination.next') ?> ›</a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
|
||||
<?php $params[$getteur] = $this->nbPage; ?>
|
||||
<li class="item pager-last">
|
||||
<a href="<?= Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)) ?>"><?= _t('conf.logs.pagination.last') ?> »</a>
|
||||
|
||||
@@ -27,6 +27,13 @@ class Minz_Request {
|
||||
public static function params() {
|
||||
return self::$params;
|
||||
}
|
||||
/**
|
||||
* Read the URL parameter
|
||||
* @param string $key Key name
|
||||
* @param mixed $default default value, if no parameter is given
|
||||
* @param bool $specialchars special characters
|
||||
* @return mixed value of the parameter
|
||||
*/
|
||||
public static function param($key, $default = false, $specialchars = false) {
|
||||
if (isset(self::$params[$key])) {
|
||||
$p = self::$params[$key];
|
||||
|
||||
Reference in New Issue
Block a user