$page_start = $page * $per_page; $per_page = $per_page + 1; # We are forcing pagination $force_nextpage = true; } else { # Getting our total number of pages for ($i = 0; i < $G_PARTITIONS_COUNT; $i++) { # Storing partition $partition = $G_PARTITIONS[$i]; # Connecting if we need to connect if (!isset($partition['dblink'])) { $partition['dblink'] = mysqli_shared_connect($partition['host'], $partition['username'], $partition['password'], $G_SHARED_DBLINKS); } # Adding to the count $query->set_table($partition['table_name'], false, false, $partition['database']); $count_query = $query->get_select_count_query(); $count_data = mysqli_single_result_query($partition['dblink'], $count_query); $matched_count += $count_data['count']; } # Handling our pages $per_page = isset($_CGET['limit']) ? min((int) $_CGET['limit'], $G_APP_DATA['results_limit']) : $G_APP_DATA['results_limit']; $page = isset($_CGET['page']) ? abs((int) $_CGET['page']) : 0; $page_start = $page * $per_page; $pages = floor(($matched_count - 1) / $per_page); } # Tracking partitions read from $G_READ_PARTITION_IDS = []; # Getting our data $content = []; $partition_per_page = $per_page; $matched_count = 0;