Allow only one %d in the filename

Fixes crashes if you had %s and similar in the filename

Inspired from patch by Pedro Ribeiro <pedrib@gmail.com>

Bug #69434