How are processes evaluated in VHDL if a signal appears/does not appear in a sensitivity list and a nested IF statement?
The entire process will be evaluated if any signal in the sensitivity list changes.

The counted value needs to be in a clocked register, otherwise you create a combinational feedback loop. Therefore, the value of counted should only be changed on a rising clock edge.