Validate limit clause and set empty default if there is no limit.

This commit is contained in:
Peter Fabian 2019-01-29 12:18:30 +01:00
parent c2eaf6d71c
commit bee26375f9
1 changed files with 5 additions and 2 deletions

View File

@ -297,9 +297,12 @@ class WC_Admin_Reports_Orders_Stats_Segmenting extends WC_Admin_Reports_Segmenti
*/ */
protected function get_order_related_intervals_segments( $segmenting_select, $segmenting_from, $segmenting_where, $segmenting_groupby, $table_name, $intervals_query ) { protected function get_order_related_intervals_segments( $segmenting_select, $segmenting_from, $segmenting_where, $segmenting_groupby, $table_name, $intervals_query ) {
global $wpdb; global $wpdb;
$segmenting_limit = '';
$limit_parts = explode( ',', $intervals_query['limit'] ); $limit_parts = explode( ',', $intervals_query['limit'] );
$orig_rowcount = intval( $limit_parts[1] ); if ( 2 === count( $limit_parts ) ) {
$segmenting_limit = $limit_parts[0] . ',' . $orig_rowcount * count( $this->get_all_segments() ); $orig_rowcount = intval( $limit_parts[1] );
$segmenting_limit = $limit_parts[0] . ',' . $orig_rowcount * count( $this->get_all_segments() );
}
$intervals_segments = $wpdb->get_results( $intervals_segments = $wpdb->get_results(
"SELECT "SELECT