Painful sex a week before period

lo

I am a week away from getting my period and just had sex which was very painful. I have never had pain during sex, does it have to do with the fact that I am getting my period in a week or could it be a std?