199 $cnt = $query->
exec()->getSelectedRowsCount();
203 if(isset($arNavStartParams[
"SubstitutionFunction"]))
205 $arNavStartParams[
"SubstitutionFunction"]($this, $query->
getLastQuery(), $cnt, $arNavStartParams);
209 if(isset($arNavStartParams[
"bDescPageNumbering"]))
210 $bDescPageNumbering = $arNavStartParams[
"bDescPageNumbering"];
212 $bDescPageNumbering =
false;
214 $this->InitNavStartVars($arNavStartParams);
215 $this->NavRecordCount = $cnt;
217 if($this->NavShowAll)
218 $this->NavPageSize = $this->NavRecordCount;
221 $this->NavPageCount = ($this->NavPageSize>0 ? floor($this->NavRecordCount/$this->NavPageSize) : 0);
222 if($bDescPageNumbering)
225 if($this->NavPageSize > 0)
226 $makeweight = ($this->NavRecordCount % $this->NavPageSize);
227 if($this->NavPageCount == 0 && $makeweight > 0)
228 $this->NavPageCount = 1;
231 $this->calculatePageNumber($this->NavPageCount);
234 $NavFirstRecordShow = 0;
235 if($this->NavPageNomer != $this->NavPageCount)
236 $NavFirstRecordShow += $makeweight;
238 $NavFirstRecordShow += ($this->NavPageCount - $this->NavPageNomer) * $this->NavPageSize;
239 $NavLastRecordShow = $makeweight + ($this->NavPageCount - $this->NavPageNomer + 1) * $this->NavPageSize;
243 if($this->NavPageSize > 0 && ($this->NavRecordCount % $this->NavPageSize > 0))
244 $this->NavPageCount++;
247 $this->calculatePageNumber(1,
true, (
bool)($arNavStartParams[
"checkOutOfRange"] ??
false));
248 if ($this->NavPageNomer ===
null)
254 $NavFirstRecordShow = $this->NavPageSize*($this->NavPageNomer-1);
255 $NavLastRecordShow = $this->NavPageSize*$this->NavPageNomer;
258 $NavAdditionalRecords = 0;
259 if(is_set($arNavStartParams,
"iNavAddRecords"))
260 $NavAdditionalRecords = $arNavStartParams[
"iNavAddRecords"];
262 if(!$this->NavShowAll)
265 $query->
setLimit($NavLastRecordShow - $NavFirstRecordShow + $NavAdditionalRecords);
268 $res_tmp = $query->
exec();
277 if($this->SqlTraceIndex)
278 $start_time = microtime(
true);
280 $temp_arrray = array();
281 $temp_arrray_add = array();
284 while($ar = $res_tmp->fetch())
287 if (intval($NavLastRecordShow - $NavFirstRecordShow) > 0 && $tmp_cnt > ($NavLastRecordShow - $NavFirstRecordShow))
288 $temp_arrray_add[] = $ar;
290 $temp_arrray[] = $ar;
293 if($this->SqlTraceIndex)
296 $exec_time = round(microtime(
true) - $start_time, 10);
297 $DB->addDebugTime($this->SqlTraceIndex, $exec_time);
298 $DB->timeQuery += $exec_time;
301 $this->arResult = (!empty($temp_arrray)? $temp_arrray :
false);
302 $this->arResultAdd = (!empty($temp_arrray_add)? $temp_arrray_add :
false);
303 $this->nSelectedCount = $cnt;
304 $this->bDescPageNumbering = $bDescPageNumbering;
305 $this->bFromLimited =
true;