mixin renderPaginationBar (baseUrl, totalItemCount, urlParameters = '')
  -
    var startPage = pagination.p - 2;
    if (startPage < 1) {
      startPage = 1;
    }
    var endPage = startPage + 4;
    var lastPage = Math.floor(totalItemCount / pagination.cpp);
    if ((totalItemCount % pagination.cpp) !== 0) {
      ++lastPage;
    }
    if (endPage > lastPage) {
      endPage = lastPage;
    }

  ul(aria-label="Page navigation").uk-pagination.uk-flex-center
    li(class= (pagination.p === 1) ? 'uk-disabled' : undefined)
      a(href=`${baseUrl}?p=${pagination.p - 1}${urlParameters}`)
        span(uk-pagination-previous).uk-margin-small-right
        span prev

    while startPage <= endPage
      li(class= (startPage === pagination.p) ? 'active' : undefined)
        a(href=`${baseUrl}?p=${startPage}${urlParameters}`)= startPage++

    li(data-last-page= lastPage, class= (pagination.p === lastPage) ? 'uk-disabled' : undefined)
      a(href=`${baseUrl}?p=${pagination.p + 1}${urlParameters}`)
        span next
        span(uk-pagination-next).uk-margin-small-left