An inelegant solution to limiting pages shown

This could be made configurable, but it works for my current purposes.