build infrastruture, detect pagination