Fix page generation when there is no pages