Added guard against zero-length page sizes