From c9ba45839c0e2521d507d95757ab1bfdb0a307ec Mon Sep 17 00:00:00 2001 From: Luis Herranz Date: Mon, 10 Jan 2022 10:58:50 +0100 Subject: [PATCH] Check that per_page is not zero before using it (#37788) --- packages/block-library/src/comments-pagination-next/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/comments-pagination-next/index.php b/packages/block-library/src/comments-pagination-next/index.php index 21ce3a1babfbd..d5d335ed62b50 100644 --- a/packages/block-library/src/comments-pagination-next/index.php +++ b/packages/block-library/src/comments-pagination-next/index.php @@ -23,7 +23,7 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo } } $comments_number = (int) get_comments_number(); - $max_page = isset( $per_page ) ? (int) floor( $comments_number / $per_page ) : 0; + $max_page = 0 !== $per_page ? (int) floor( $comments_number / $per_page ) : 0; $default_label = __( 'Next Comments' ); $label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label; $pagination_arrow = get_comments_pagination_arrow( $block, 'next' );