added ability to provide custom count for pagination