aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2021-01-20 22:12:15 +0100
committerMax Kostikov <max@kostikov.co>2021-01-20 22:12:15 +0100
commitab4455c54c457d2eff773d7b7c1a723489c13bad (patch)
tree7c23d66e1f55bd4e2048a0a18297912f7628defa /include/items.php
parent15b2aa660ba99b7a17aa811041a40739f258672f (diff)
parent6cca06f6414547b3b7f38044ee808620e8dfdf43 (diff)
downloadvolse-hubzilla-ab4455c54c457d2eff773d7b7c1a723489c13bad.tar.gz
volse-hubzilla-ab4455c54c457d2eff773d7b7c1a723489c13bad.tar.bz2
volse-hubzilla-ab4455c54c457d2eff773d7b7c1a723489c13bad.zip
Merge branch 'dev' into 'dev'
Dev sync See merge request kostikov/core!2
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/items.php b/include/items.php
index bfca354d1..5b9bbd1f9 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4562,9 +4562,11 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
// only setup pagination on initial page view
$pager_sql = '';
} else {
- $itemspage = (($channel) ? get_pconfig($uid,'system','itemspage') : 10);
- App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 10));
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
+ if(! $arr['total']) {
+ $itemspage = (($channel) ? get_pconfig($uid,'system','itemspage') : 20);
+ App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
+ }
}
if (isset($arr['start']) && isset($arr['records']))
@@ -4613,6 +4615,18 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
// "New Item View" - show all items unthreaded in reverse created date order
+ if ($arr['total']) {
+ $items = q("SELECT count(item.id) AS total FROM item
+ WHERE $item_uids $item_restrict
+ $simple_update
+ $sql_extra $sql_nets $sql_extra3"
+ );
+ if ($items) {
+ return intval($items[0]['total']);
+ }
+ return 0;
+ }
+
$items = q("SELECT item.*, item.id AS item_id FROM item
WHERE $item_uids $item_restrict
$simple_update