Add iteration logic to add pages automatically