Finished function to divide plain text into pages.