I followed the tutorial from CG Geek (https://www.youtube.com/watch?v=SBYb1YmaOMY) and added all bones. I added the inverse kinematics bone constraint to the lower leg and added the controller bone. When I move the controller bone the leg bends sideways to the x coordinate. When I set the pole angle to 90 degrees it works fine but the foot is pointing to the wrong direction.
Foot pointing forwards:
Leg bending forwards:
Thanks for helping.
Edit: Here is the blender file: https://www.mediafire.com/file/uhkki052u9es30e/Human.blend/file