Log min and max id inside the loop