Title: Pagination URL Encoding Bug
Last modified: April 5, 2024

---

# Pagination URL Encoding Bug

 *  Resolved [pk385](https://wordpress.org/support/users/pk385/)
 * (@pk385)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/pagination-url-encoding-bug/)
 * Hi, love your plugin but there is a bug in the free Version 6.4.7.2 regarding
   pagination. On line 1128 of `classes/em-object.php` this line:
 *     ```wp-block-code
       $page_link_template = em_add_get_params($page_url, $page_args_escaped, false); //don't html encode, so em_paginate does its thing;
       ```
   
 * Is intended to construct the pagination link template to be passed to `em_paginate`
   function with the `%page%` placeholder but this placeholder itself ends up URL
   encoded making it impossible for `em_paginate` to do its required page number
   string replacement.
 * This stems from the incorrect number of arguments in the line mentioned above.
   Looking at the `em_add_get_params` function definition we can see that the last
   parameter always defaults to true:
 *     ```wp-block-code
       function em_add_get_params($url, $params=array(), $html=true, $encode=true){…}
       ```
   
 * This results in the `%page%` segment of the `$page_link_template` variable being
   URL encoded, to `%25page%25`. This link template string is then passed to the`
   em_paginate` function here on line 1130:
 *     ```wp-block-code
           $return = apply_filters('em_object_get_pagination_links', em_paginate( $page_link_template, $count, $limit, $page, $unique_args, !empty($args['ajax']) ), $page_link_template, $count, $limit, $page);
       ```
   
 * The `em_paginate` function is not expecting this URL encoded segment, and double
   URL encodes it before attempting the placeholder string find/replacement operation,
   which results in it not being able to find/replace the placeholder and the pagination
   link passed to the frontend being broken like:
 *     ```wp-block-code
       …/events/categories/some-event/?pno=%2525PAGE%2525
       ```
   
 * I think the only change necessary to fix this is adding an additional `false`
   argument to the `em_add_get_params` function call on line 1128 like so:
 *     ```wp-block-code
       $page_link_template = em_add_get_params($page_url, $page_args_escaped, false, false);
       ```
   
 * Hope you can get a fix out soon and thank you for the awesome plugin!
    -  This topic was modified 2 years, 2 months ago by [pk385](https://wordpress.org/support/users/pk385/).
      Reason: formatting

Viewing 1 replies (of 1 total)

 *  Thread Starter [pk385](https://wordpress.org/support/users/pk385/)
 * (@pk385)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/pagination-url-encoding-bug/#post-17678067)
 * Resolved with update **6.4.7.3**, thanks guys!

Viewing 1 replies (of 1 total)

The topic ‘Pagination URL Encoding Bug’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [pk385](https://wordpress.org/support/users/pk385/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/pagination-url-encoding-bug/#post-17678067)
 * Status: resolved