of course this is the right behavior:
when you click on a category child then the current IS that child, so you print all previous levels and same levels that both have ul_class_same_level’ => “sideList”
as you specified in the code, there are NO children of “sovata”, because when selected it became at the current level, understood?
solutions are multiple:
the best one that I have in mind is to check if the selected category has a parent or not, if yes initialize $params array in a different way.