More robust implementation of pdf_page_reference_numbers for malformed
files