.(JavaScript must be enabled to view this email address)
+44 (0) 1584 778 008


BU Search Pagination


Additional pagination tags for the Search module.


Add this into your template when you wish to have greater control over customising the pagination tags on your search results page.

The plugin bases the output of its pagination on the search results (per page limit) and result_page parameters set in your search form tag and the total number of results calculated by the Search Module.

You can use this plugin to access pagination information in 1 of 2 ways: as a standard tag pair with a set of variables (recommended) or via parameters - this latter way is included because it was how the plugin started - so for backwards compatibility and in case anyone is curious. Note: the pagination_pages pair variable and the variables it contains are not available via tag parameters.


You’ll need to be using the Search module

The EE1 compatible version has been tested in ExpressionEngine 1.6.4 +.
The EE2 compatible version has been tested in ExpressionEngine 2.1.0, 2.1.1, 2.4.0. You will need 2.1.1 or higher.

Be warned, there were issues with EE 2.1.0’s native treatment of paginating search results, and in EE 2.1.1 the way that search pagination works changed too, so you should upgrade to the latest install of EE.



There are plugins for both EE1 and for EE2 in the download package.

Just unzip the package, select the appropriate folder, follow its path, and FTP its final contents to the correct folder in your installation.

For EE1 that is /system/plugins/plugin.php
For EE2 that is /system/expressionengine/third_party/plugin_name/plugin.php


The tag pair is as follows:


Variables available within it are


They are largely self-explanatory, but the last two provide reference to the results available on the current page, e.g. on the 2nd page where you have 5 results per page, page_results_first would be 6, page_results_last would be 10, so you can display ‘results 6 - 10’.

There is a pair variable called pagination_pages that by default outputs additional data for all search result pages.


This has 2 parameters available to it - format and limit

pagination_pages has the following single variables available within it


count tells you what position you are on in the pagination_pages loop. page_number tells you the page number for the current result page processed. page_path provides a link path for the current result page processed.

The format parameter for pagination_pages allows you to change the pagination so that it is split up into blocks of pages. By default each block contains up to 5 sets of result pages. The limit parameter allows you to change that.

For example, if you had 19 pages of results and a ‘limit’ of 4, pages 1-4 would be the first block, 5-8 the second and so on. The final block would have 3 pages.

If you’ve specified a format parameter of ‘block’ then the following single variables also become available within pagination_pages:


total_block_pages just reflects the number of blocks that the results have been split into. If you don’t specify a ‘limit’ this will be 5 as that’s the default limit.

prev_block_path provides the link back to the first page within the previous block. prev_block_pages provides a reference for the pages contained within the previous block. This follows the format 1 - 4, 5 - 8 etc. Neither of these two variables will be available on pages within the first block.

next_block_path provides the link to the first page within the next block. next_block_pages provides a reference for the pages contained within the next block. This follows the format 4 - 8, 9 - 12 etc. Neither of these two variables will be available on pages within the last block.

There is one permitted parameter for the bu_search_pagination tag - type. Note: if you use the type parameter, the standard variables usually available in the tag pair will not be output.

The variants available for the type parameter basically follow the same naming convention used for variables within the tag pair:

{exp:bu_search_pagination type='current_page'}
{exp:bu_search_pagination type='total_pages'}
{exp:bu_search_pagination type='prev_page_path'}
{exp:bu_search_pagination type='next_page_path'}
{exp:bu_search_pagination type='first_page_path'}
{exp:bu_search_pagination type='last_page_path'}
{exp:bu_search_pagination type='page_results_first'}
{exp:bu_search_pagination type='page_results_last'}

Pagination results for the prev_page_path, next_page_path, first_page_path and last_page_path parameters are only output when they are actually available, i.e. not when there is just a single page of results.


Here is an example of usage without using the pagination_pages pair variable:

{if prev_page_path}
 <a href="{path={prev_page_path}}">Prev</a>

<p>Page {current_page} of {total_pages} </p>

{if next_page_path}
 <a href="{path={next_page_path}}">Next</a>

Here is another example to show which search results are being displayed on a page:

Results {page_results_first} - {page_results_last}

Here is an example using the pagination_pages pair variable:

{pagination_pages format='block' limit='10'}
{if prev_block_path!='' AND count==1}
<a href='{path={prev_block_path}}'>{prev_block_pages}</a>

{if page_number==current_page}
<a href='{path={page_path}}'>{page_number}</a> 

{if next_block_path!='' AND count==total_block_pages}
<a href='{path={next_block_path}}'>{next_block_pages}</a>

And here is an example using parameters:

{if "{exp:bu_search_pagination type='prev_page_path'}" !=''}
<a href="{path={exp:bu_search_pagination type='prev_page_path'}}">
Page {exp:bu_search_pagination type='current_page'} 
of {exp:bu_search_pagination type='total_pages'} 

{if "{exp:bu_search_pagination type='next_page_path'}" !=''}
<a href="{path={exp:bu_search_pagination type='next_page_path'}}">


Please contact us for support.

Archived Forum topic: http://expressionengine.com/forums/viewthread/96995/.

Change Log

Version 2.1.2
Fixed logic for EE version check. Thanks Peter.
Version 2.1.1
Updated to replace ereg deprecated in PHP 5.3.x
Version 2.1.0
Applied fix to deal with EllisLab's changed search pagination format now bugs settled down. EE 2.1.0 bad, EE 2.1.1 good.
Version 2.0.0
Converted to EE2 format retaining legacy form for templates
Version 1.2.0
Added pair variable pagination_pages for results and page_number, page_path and count variables per page. Added parameters to pagination_pages for format and limit. Pagination_pages has single variables for breaking paginated pages into blocks of pages. Single variables then available are prev_block_path, prev_block_pages, next_block_path, next_block_pages, and total_block_pages.
Version 1.1.1
Added page_results_first and page_results_last
Version 1.1.0
Overhauled to work as a tag pair with variables rather than using parameter. Fixed bug in last_page_path
Version 1.0.1
Converted to EE developer's guidelines
Version 1.0.0
First release - added options for first and last page

Last edited

11 December 2016



By downloading this software you assume all responsibility for its use and absolve BridgingUnit of any liability and/or responsibility.