Can you get pregnant from protected sex?

Rebecca

I'm in a LDR with my boyfriend of almost 7 months. We try to visit each other every other month and we're always having sex when we are together unless I'm in my period. Well one time we were having sex with a condom and when he pulled out, the condom was rolled down a little bit and there was white stuff on my leg. Not sure if it was from me or him, but I inspected the condom and it wasn't broken. A few days after that when I got home, I got my period so I thought I'm safe. But recently I haven't been able to fall asleep till early in the morning (midnight). Does anyone think I should do a pregnancy test just in case? I watched a baby show on TLC once where the woman had her period but found out she was pregnant without knowing.