This commit is contained in:
Albert Juhé Lluveras 2019-03-21 15:35:25 +01:00 committed by GitHub
parent 41e5d00708
commit 1cf134d1fa
1 changed files with 7 additions and 1 deletions

View File

@ -177,11 +177,17 @@ class WC_Admin_Reports_Orders_Data_Store extends WC_Admin_Reports_Data_Store imp
) AS tt"
); // WPCS: cache ok, DB call ok, unprepared SQL ok.
$total_pages = (int) ceil( $db_records_count / $sql_query_params['per_page'] );
if ( 0 === $sql_query_params['per_page'] ) {
$total_pages = 0;
} else {
$total_pages = (int) ceil( $db_records_count / $sql_query_params['per_page'] );
}
if ( $query_args['page'] < 1 || $query_args['page'] > $total_pages ) {
$data = (object) array(
'data' => array(),
'total' => $db_records_count,
'pages' => 0,
'page_no' => 0,
);
return $data;
}