[BACKLOG-1015] Fixed a bug in the routine that updates min and max array...

... indexes for a path. Adding unit test.