simple pagination tool with sorting functions