Does this loop require the input to be padded in groups of 4 or else the offset will be past the end of the page?

e.g. if the page had values 0, 0, 0. The necessary bytes are 0 (first byte), 0, 0, 0. But totalLength[0] would return 4, 1 byte past the end.  We should be very explicit about the padding behavior.

Also, whats the point of the + and %?