A generic way to split an array into pages, with optional callbacks for specifying the structure of each page.