UTI first 3 weeks of pregnancy

Just found out I have had a UTI for the past three weeks of my pregnancy. I am only 5 weeks along. I’m so scared of a miscarriage. Anyone have this happen before?? I had no idea I had one. I’ve never had one before.