$selectFields = array_keys($selectFields); } $getListParams = array( 'select' => $selectFields, 'filter' => $filter, 'order' => array($by => $order) ); if ($usePageNavigation) { $getListParams['limit'] = $navyParams['SIZEN']; $getListParams['offset'] = $navyParams['SIZEN']*($navyParams['PAGEN']-1); } $totalPages = 0; if ($usePageNavigation) { $countQuery = new Main\Entity\Query(Internals\DiscountCouponTable::getEntity()); $countQuery->addSelect(new Main\Entity\ExpressionField('CNT', 'COUNT(1)')); $countQuery->setFilter($getListParams['filter']); $totalCount = $countQuery->setLimit(null)->setOffset(null)->exec()->fetch(); unset($countQuery); $totalCount = (int)$totalCount['CNT']; if ($totalCount > 0) { $totalPages = ceil($totalCount/$navyParams['SIZEN']); if ($navyParams['PAGEN'] > $totalPages) $navyParams['PAGEN'] = $totalPages; $getListParams['limit'] = $navyParams['SIZEN']; $getListParams['offset'] = $navyParams['SIZEN']*($navyParams['PAGEN']-1); } else {