%_max_counter% can give the value for the wrong loop. E.g. whereas the last line of the output of the Export script
-- nested loops
$loop(%_directory%)$loop(%_filename%)%_directory%/%_filename%
$loopend()$loopend()
-- single loop
$loop(%_filename%)%_directory%/%_filename%
$loopend()
max_counter: %_max_counter% (i.e. %_max_counter%)
should be e.g.
-- nested loops
a/x
a/x
b/y
b/y
c/z
c/z
-- single loop
a/x
a/x
b/y
b/y
c/z
c/z
max_counter: 6 (i.e. 6)
instead it is
...
max_counter: 3 (i.e. 6)
max_counter can also erroneously return null:
-- nested loops
$loop(%_directory%)$loop(%_filename%)%_directory%/%_filename%
$loopend()$loopend()
max_counter: %_max_counter% (i.e. %_max_counter%)
gives e.g.
-- nested loops
a/x
a/x
b/y
b/y
c/z
c/z
max_counter: 3 (i.e. )