hbs.registerHelper('paginate', function(pagination, context) {
    var lists = '';

    if (pagination.isFirstPage) {
      lists += '<li class="disabled"><a href="#">&laquo; Prev</a></li>';
    }
    else {
      lists += '<li><a href="' + pagination.base + '?';

      lists += 'p=' + pagination.prev + '">' + '&laquo; Prev</a></li>';
    }


    pagination.items.forEach(function (page) {
      if (page === '...') {
        lists += '<li class="disabled"><a href="#">...</a></li>';
      }
      else {
        lists += '<li ';

        if (page === pagination.currentpage) {
          lists += 'class="active"';
        }

        lists += '><a href="' + pagination.base + '?';

        lists += 'p=' + page +'">' + page + '</a></li>';
      }
    });

    if (pagination.isLastPage) {
      lists += '<li class="disabled"><a href="#">Next &raquo;</a></li>';
    } else {
      lists += '<li><a href="' + pagination.base + '?';

      lists += 'p=' + pagination.next + '">' + 'Next &raquo;</a></li>';
    }

    return lists;
  });