Fix issue #25: add check image count to determine next page availability