Account for pos.end when generating pages from items, fixes #97