'rest_post_invalid_page_number',
__( 'The page number requested is larger than the number of pages available.'
),
array
( 'status' => 400
) );
} $response =
rest_ensure_response( $posts );
$response->
header( 'X-WP-Total',
(int) $total_posts );
$response->
header( 'X-WP-TotalPages',
(int) $max_pages );
$request_params =
$request->
get_query_params();
$collection_url =
rest_url( rest_get_route_for_post_type_items( $this->post_type
) );
$base =
add_query_arg( urlencode_deep( $request_params ),
$collection_url );
if ( $page > 1
) { $prev_page =
$page - 1;
if ( $prev_page >
$max_pages ) { $prev_page =
$max_pages;
} $prev_link =
add_query_arg( 'page',
$prev_page,
$base );