Fix pagination error on generation

Sporadically seeing IndexErrors when generating site with Paginator; pages reference was sometimes empty. This fixes that issue.