backend: Rework maxi_text_process and make it static

Reduce the scope of ephemeral (i, j, count, current) variables, and remove
unneeded variables.
backend: Make another i variable local to the loop (at maxi_do_primary_2)