add JS version of pagination helper