• Resolved pk385

    (@pk385)


    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:

    $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:

    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:

        $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:

    …/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:

    $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, 1 month ago by pk385. Reason: formatting
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

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