Refactor array index handling in input filter, to make it work in all cases.
Add tests for max_array_index_length filter