PHPDev.org

Laravel, Yii and Bitrix programmers

info@phpdev.org +7 993 898-44-62 +7 993 898-44-62
Order a call
PHPDev.org

Меню

  • Услуги
    • Разработка и поддержка
    • Сайты и веб приложения
    • Интернет-магазин
    • Корпоративные сайты
    • CRM
    • Личные кабинеты
    • Редизайн сайта
    • Готовые решения
    • Бэкэнд для мобайла
    • Разработка Чат-ботов
    • Интеграции
    • CRM
    • Системы доставки
    • Системы оплаты
    • 1C
    • Интеграция 1С с Bitrix и Bitrix24
    • Развитие
    • Обновление Битрикс
    • Обновление PHP
    • Аудит безопасности
    • Удаление вирусов
    • Доработка сайта на Битрикс
    • Верстка сайта по макетам
    • Доработка коробки Битрикс24
    • Перенос с другой CMS на Битрикс
    • Парсинг данных с сайта
    • Ускорение сайта по Google Page Speed
    • Доработка дизайна и структуры сайта для повышения конверсии
    • Техническая поддержка
    • Поддержка интернет-магазина
    • Поддержка сайтов на Битрикс
    • Поддержка сайтов на WordPress
    • Поддержка сайтов на Laravel
  • Support
  • development
  • OUR CASES
    • on Bitrix
    • on Bitrix 24
    • on Laravel
    • on Yii2
  • About company
  • blog
  • Contacts
  • GALLERY
RU | EN
  1. Home
  2. notes
  3. Strange pagination behavior in Bitrix

Blog

Strange pagination behavior in Bitrix

12/10/2021
712
Pagination has never been an issue, the mechanism has been well-tested for a long time. However, we came across a very interesting behavior.
In Bitrix, pagination is typically built using the get parameter PAGEN1=2, where 1 is the pagination number and 2 is the page number.

What is the purpose of the pagination number? If there are multiple components with pagination on the page, the parameter for the first component will be PAGEN1, the second component will have PAGEN2, and so on. This allows each component to maintain its own results when switching pages.

We noticed a problem: on the catalog page, when we choose a page number, everything works correctly. But when we choose a different number, the pagination stops working. It's inconsistent - sometimes it works, sometimes it doesn't.

The template and the system.pagenavigation component are both standard.
We checked the $arResult array, and the NavNum (the pagination number) is 4. We refreshed the page, and NavNum is still 4. We refreshed again, and suddenly NavNum becomes 2.

We reviewed all the components above the catalog, and none of them use pagination.
(Strange, it always seemed like the pagination number was based on the component number on the page that uses pagination)

We delved into the core and examined where and how this NavNum is determined. It turns out that every time the InitNavStartVars() method is called, the NavNum parameter is simply incremented. Okay, it's incremented, but on our page, only one component uses pagination. So where does the number 4 come from?
We inserted debugbacktrace() into the function and examined the call stack.

It turns out that there are agents on the site that use CIBlockElement::GetList(), and if you pass the nPageSize parameter, it triggers the call to InitNavStartVars() and increments the NavNum. Since the agent doesn't run on every hit, the NavNum changes periodically, causing the pagination to fail.
So, if you encounter a similar problem, pay attention to the parts of the code that use CIBlockElement::GetList() with the nPageSize parameter first.

Back to list

ЧИТАЙТЕ ТАКЖЕ

Uploading Large Files in Parts with Laravel


Связаться с нами:
Политика обработки персональных данных Политика обработки файлов cookie
Разработка и поддержка Интеграции Развитие
Аутстафф Техническая поддержка
Блог Кейсы О компании
220073, РБ, г. Минск,
ул. Ольшевского, 22, офис 20
info@phpdev.org
© PHPDev.ORG, 2025 ООО «ПиЭйчПиДев», УНП 193010251
Quality Performance Website promotion
phpdev.org Laravel, Yii and Bitrix programmers
Laravel, Yii and Bitrix programmers
BY
  • BY
  • RU
  • UA

By clicking the "Submit a request" button, you consent to the processing of Personal data.

phpdev.org Laravel, Yii and Bitrix programmers
Thank you! The application has been successfully sent. We will contact you shortly

Продолжая использовать сайт, вы соглашаетесь с Политикой обработки персональных данных и Политикой использования файлов cookie. .