changed the whilst loop to a doWhilst in #paginate()

This is to make sure that the loop executes at least once. If we pass in
an empty string for the markup we'll want at least one empty page.