do page offsets correctly (depending on display type)

darcs-hash:20081120114137-84dde-6d55cab81e0b23628cf9aa0360b9de2f866ba186.gz
This commit is contained in:
Evan Prodromou 2008-11-20 06:41:37 -05:00
parent aab4228b53
commit d84c89a873

View File

@ -20,6 +20,8 @@
if (!defined('LACONICA')) { exit(1); } if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/profilelist.php');
# 10x8 # 10x8
define('AVATARS_PER_PAGE', 80); define('AVATARS_PER_PAGE', 80);
@ -81,9 +83,11 @@ class GalleryAction extends Action {
$other = new Profile(); $other = new Profile();
list($lst, $usr) = $this->fields(); list($lst, $usr) = $this->fields();
$offset = ($page-1)*AVATARS_PER_PAGE; $per_page = ($display == 'list') ? PROFILES_PER_PAGE : AVATARS_PER_PAGE;
$limit = AVATARS_PER_PAGE + 1;
$offset = ($page-1)*$per_page;
$limit = $per_page + 1;
if (common_config('db','type') == 'pgsql') { if (common_config('db','type') == 'pgsql') {
$lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset; $lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset;