{
$request = $this->getRequest([
'limit' => 10, // Maximum number of results to return. Defaults to 10.
+ 'offset' => 0, // Offset page, Defaults to 0.
], $request);
$condition = ["EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-view`.`uri-id` AND `type` = ? AND NOT `name` IS NULL AND NOT `description` IS NULL) AND NOT `private` AND `commented` > ? AND `created` > ?",
$condition = DBA::mergeConditions($condition, ['network' => Protocol::FEDERATED]);
$trending = [];
- $statuses = Post::selectPostThread(['uri-id', 'total-comments', 'total-actors'], $condition, ['limit' => $request['limit'], 'order' => ['total-actors' => true]]);
+ $statuses = Post::selectPostThread(['uri-id', 'total-comments', 'total-actors'], $condition, ['limit' => [$request['offset'], $request['limit']], 'offset' => $request['offset'], 'order' => ['total-actors' => true]]);
while ($status = Post::fetch($statuses)) {
$history = [['day' => (string)time(), 'uses' => (string)$status['total-comments'], 'accounts' => (string)$status['total-actors']]];
$trending[] = DI::mstdnCard()->createFromUriId($status['uri-id'], $history)->toArray();
$request = $this->getRequest([
'limit' => 10, // Maximum number of results to return. Defaults to 10.
+ 'offset' => 0, // Offset page, Defaults to 0.
], $request);
$condition = ["NOT `private` AND `commented` > ? AND `created` > ?", DateTimeFormat::utc('now -1 day'), DateTimeFormat::utc('now -1 week')];
$display_quotes = self::appSupportsQuotes();
$trending = [];
- $statuses = Post::selectPostThread(['uri-id'], $condition, ['limit' => $request['limit'], 'order' => ['total-actors' => true]]);
+ $statuses = Post::selectPostThread(['uri-id'], $condition, ['limit' => [$request['offset'], $request['limit']], 'order' => ['total-actors' => true]]);
while ($status = Post::fetch($statuses)) {
try {
$trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes);