Recent Changes - Search:



Limit Diffs per page

Summary: Paginate the "diff" output (when viewing a page history, limit the number of displayed revisions at once)
Version: 20100217
Prerequisites: PmWiki post-March 2006.
Status: Stable/Beta
Maintainer: Petko

See the bottom line.

Questions answered by this recipe

Is there a possibility to display a smaller number of revisions, on a number of sub-pages?


A page history can become quite big, as seen on When you then take a look at the history, it takes quite some time. This recipe displays a smaller number of revisions, on a number of sub-pages.

This is a conversion of my fix, supplied at PITS.00544, into an independent recipe. The distribution file scripts/pagerev.php is replaced on the fly by the provided patched script.


  1. Copy one of these files to your /cookbook/ directory:
  2. Set in your (farm)config.php the following code (set the 2 accordingly):
  if ($action=='diff') {
    $DiffCountPerPage = 10; # Optional

Note. Version 20090713 of the recipe will automaticaly incorporate InlineDiff if it exists on the server. To make it work, copy the InlineDiff directories and files in the /cookbook/pagerevinline/ directory, and include_once only the LimitDiffsPerPage recipe in config.php.

Note that recent PmWiki versions have a word-level diff highlighting, so PmWiki 2.2.12 with the latest limitdiffsperpage2.php version 20100217 or newer do not need the InlineDiff files. See $EnableDiffInline.


The one and only configuration variable is $DiffCountPerPage. You can set it to the number of revisions that will be displayed on every page:

   $DiffCountPerPage = 4;  # show 4 revisions
   $DiffCountPerPage = 10; # show 10 revisions (recipe default)
   $DiffCountPerPage = 0;  # show all revisions, like PmWiki


The PmWiki methods to display page history were modified and simplified in PmWiki version 2.2.11 and 2.2.12.

  • With PmWiki version 2.2.11 or earlier, you have to use the limitdiffsperpage.phpΔ script version 20090713 (which will work with newer PmWiki versions too).
  • With PmWiki version 2.2.12 or newer, you can use the limitdiffsperpage2.phpΔ script version 20100216 or newer.

Using this recipe to display diffs is never slower than the original pagerev.php, but it can be drastically faster, especially on pages with long revision history.

The patched file was submitted in March 2006.

The script has been tested for a long time and should work fine.

Release Notes

  • 20100217 Beta : removed a function for word-level diffs which are now handled by the PmWiki core.
  • 20100216 : Major rewrite of the script to benefit from the core changes in PmWiki 2.2.12.
  • 20090713 StableΔ : Fix bug introduced in 20090712 with display of [@escaped@] text.
  • 20090712 : Closed possible XSS vulnerability, all wikis using this recipe should upgrade.
  • 20081115 : Added automatic integration with InlineDiff if installed. Fixed ampersands in older PmWiki versions.
  • 20071120 : Changed to work with 2.2.beta64 and newer. Renamed all functions just in case a field loads another diff recipe than the wikifarm.

See Also


  • Pm is the author of the original scripts/pagerev.php
  • Petko proposed the patch and is maintaining this recipe.


See discussion at LimitDiffsPerPage-Talk?

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 28, 2013, at 09:58 PM