Fix segfault when inputting three page-arguments

This fixes a probably very rare corner-case where unpaper segfaults.
Can be triggered by calling
>unpaper image1.pnm image2.pnm image3.pnm -overwrite
when all three files already exist.
The segfault is triggered by acessing `argv[optind]` in
`bool outputWildcard = multisheets && (strchr(argv[optind], '%') != NULL);`
because `optind` was incremented in the for-loop above and it isn't checked if if now is to big for the argv-array.
Because this was hard to catch without a debugger (even with -debug set) I also added some debug-output around the code. Never hurts to have that.