Description: pstoimg: using -multipage options should use zeropadding
 The option -multipage results in files ending with numbers. When
 converting a document with more than 9 pages it results in:
 .
  doc1.png
  doc2.png
  ...
  doc10.png
 .
 A filename listing therefore would result in:
 .
  doc1.png
  doc10.png
  doc2.png
  ...
 This patch makes pstoimg zeropad the numbers appropriately,
 when the document has more than 9 pages (and maybe when it has more
 than 99 pages again), resulting in:
 .
  doc01.png
  doc01.png
  ...
  doc10.png 
Author: Hamish <hamish_b@yahoo.com>
Bug: http;//bugs.debian.org/247150

--- latex2html-2015-debian1.orig/pstoimg.pin
+++ latex2html-2015-debian1/pstoimg.pin
@@ -1009,11 +1009,14 @@ sub pstoimg {
     my @list = grep(/^\d+_${pnmbase}\.pnm/,readdir(DIR));
     closedir(DIR);
     if(@list) {
+      sub log10 { log($_[0]) / log(10) }
+      my $len = int(log10(@list))+1;
       my $i;
       foreach $i (@list) {
         my ($n) = $i =~ /^(\d+)_/;
+        my $n_pad = sprintf("%0${len}d", $n);
         my $j = $outfile;
-        $j =~ s|(\.[^/.]*)$|$n$1|;
+        $j =~ s|(\.[^/.]*)$|_$n_pad$1|;
 	if(crop_scale_etc("$pnmdir$i", $j)) {
           L2hos->Unlink("$pnmdir$i") unless($opt{debug});
           }
