protected function addNextSearchLinks( $request, $response ) {

		$max_pages = (int) ceil( $this->totalBooks / (int) $request['per_page'] );

		$response->header( 'X-WP-Total', (int) $this->totalBooks );
		$response->header( 'X-WP-TotalPages', $max_pages );

		if ( $this->lastKnownBookId ) {
			unset( $request['page'] );
			$request_params = $request->get_query_params();
			$base = add_query_arg( $request_params, rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
			$next_link = add_query_arg( 'next', $this->lastKnownBookId, $base );
			$response->link_header( 'next', $next_link );
		}
	}
protected function addNextSearchLinks( $request, $response ) {

		$max_pages = (int) ceil( $this->totalBooks / (int) $request['per_page'] );

		$response->header( 'X-WP-Total', (int) $this->totalBooks );
		$response->header( 'X-WP-TotalPages', $max_pages );

		if ( $this->lastKnownBookId ) {
			unset( $request['page'] );
			$request_params = $request->get_query_params();
			$base = add_query_arg( $request_params, rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
			$next_link = add_query_arg( 'next', $this->lastKnownBookId, $base );
			$response->link_header( 'next', $next_link );
		}
	}
protected function addNextSearchLinks ( $ request , $ response ) { $ max_pages = ( int ) ceil ( $ this -> totalBooks / ( int ) $ request [ 'per_page' ] ) ; $ response -> header ( 'X-WP-Total' , ( int ) $ this -> totalBooks ) ; $ response -> header ( 'X-WP-TotalPages' , $ max_pages ) ; if ( $ this -> lastKnownBookId ) { unset ( $ request [ 'page' ] ) ; $ request_params = $ request -> get_query_params ( ) ; $ base = add_query_arg ( $ request_params , rest_url ( sprintf ( '%s/%s' , $ this -> namespace , $ this -> rest_base ) ) ) ; $ next_link = add_query_arg ( 'next' , $ this -> lastKnownBookId , $ base ) ; $ response -> link_header ( 'next' , $ next_link ) ; } }
Add a next link for search results

@param \WP_REST_Request $request
@param \WP_REST_Response $response
Add a next link for search results