From 7f3d31c59ea179e796618be4c20489d4c0bdee29 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Fri, 7 Jul 2023 15:09:22 +0200 Subject: [PATCH] add prev --- includes/rest/class-followers.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/rest/class-followers.php b/includes/rest/class-followers.php index edd1445..9b9ed89 100644 --- a/includes/rest/class-followers.php +++ b/includes/rest/class-followers.php @@ -80,10 +80,14 @@ class Followers { $json->first = \add_query_arg( 'page', 1, $json->partOf ); // phpcs:ignore $json->last = \add_query_arg( 'page', \ceil ( $json->totalItems / 20 ), $json->partOf ); // phpcs:ignore - if ( $page && ( ( \ceil ( $json->totalItems / 20 ) ) >= $page ) ) { // phpcs:ignore + if ( $page && ( ( \ceil ( $json->totalItems / 20 ) ) > $page ) ) { // phpcs:ignore $json->next = \add_query_arg( 'page', $page + 1, $json->partOf ); // phpcs:ignore } + if ( $page && ( $page > 1 ) ) { // phpcs:ignore + $json->prev = \add_query_arg( 'page', $page - 1, $json->partOf ); // phpcs:ignore + } + // phpcs:ignore $json->orderedItems = array_map( function( $item ) {