Currently, in the question-paper design, the page count is required in the data file. This value can easily get outdated on future updates of a data or even misconfigured initially.
A solution to this might be to generate the PDF without a count and then update the count, generating the PDF again. This is incredibly inefficient since generating a PDF is an expensive operation.
Looking for a different solution to this problem.