/**
 * Module dependencies.
 */

var mongoose = require('mongoose')
  , Article = mongoose.model('Article')

/**
 * List items tagged with a tag
 */

exports.index = function (req, res) {
  var criteria = { tags: req.param('tag') }
  var perPage = 5
  var page = req.param('page') > 0 ? req.param('page') : 0
  var options = {
    perPage: perPage,
    page: page,
    criteria: criteria
  }

  Article.list(options, function(err, articles) {
    if (err) return res.render('500')
    Article.count(criteria).exec(function (err, count) {
      res.render('articles/index', {
        title: 'Articles tagged ' + req.param('tag'),
        articles: articles,
        page: page,
        pages: Math.ceil(count / perPage)
      })
    })
  })
}

@@ -256,16 +256,17 @@
  page = 
+(
 req.para
@@ -301,17 +301,22 @@
 age') : 
-0
+1) - 1
 %0A  var o
@@ -670,24 +670,28 @@
   page: page
+ + 1
 ,%0A        pa

Fix paging