Fix getting perpage value