mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:00:16 +00:00
pagination start off by one
This commit is contained in:
parent
dd71f9446b
commit
e2a725ff98
2 changed files with 4 additions and 2 deletions
2
boot.php
2
boot.php
|
@ -442,7 +442,7 @@ if(! class_exists('App')) {
|
||||||
$this->pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1);
|
$this->pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1);
|
||||||
$this->pager['itemspage'] = 50;
|
$this->pager['itemspage'] = 50;
|
||||||
$this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
|
$this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
|
||||||
if($this->pager['start'] < 1)
|
if($this->pager['start'] < 0)
|
||||||
$this->pager['start'] = 1;
|
$this->pager['start'] = 1;
|
||||||
$this->pager['total'] = 0;
|
$this->pager['total'] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,6 +224,7 @@ function message_content(&$a) {
|
||||||
// list messages
|
// list messages
|
||||||
|
|
||||||
$o .= $header;
|
$o .= $header;
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT count(*) AS `total` FROM `mail`
|
$r = q("SELECT count(*) AS `total` FROM `mail`
|
||||||
WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
|
WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
|
||||||
|
@ -232,7 +233,7 @@ function message_content(&$a) {
|
||||||
);
|
);
|
||||||
if(count($r))
|
if(count($r))
|
||||||
$a->set_pager_total($r[0]['total']);
|
$a->set_pager_total($r[0]['total']);
|
||||||
|
|
||||||
$r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`,
|
$r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`,
|
||||||
`mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`,
|
`mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`,
|
||||||
count( * ) as count
|
count( * ) as count
|
||||||
|
@ -243,6 +244,7 @@ function message_content(&$a) {
|
||||||
intval($a->pager['start']),
|
intval($a->pager['start']),
|
||||||
intval($a->pager['itemspage'])
|
intval($a->pager['itemspage'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! count($r)) {
|
if(! count($r)) {
|
||||||
info( t('No messages.') . EOL);
|
info( t('No messages.') . EOL);
|
||||||
return $o;
|
return $o;
|
||||||
|
|
Loading…
Reference in a new issue