I was going to write "Oh, I have been flying around the whole day without being pirated...", but I just got back from eating, undocked, flew one system, pirate tried pirating me.
Yeee...So I'll just say "Guess I was lucky".
But I also fly many many different routes, all over Sirius. Everywhere. I could've gotten away without a fight on that pirate attempt as well I think. But anyway...
(4 mio for a normal freight? Eff ye, pirate! D; Sniff on me BWT's exhaust pipes!)
It's a hassle sometimes when you've lost your payup only halfway to payday. Try to Negotiate w/ 'em. Convince their character that by mugging you, he destroys a lucrative revenue stream. Just play along. (Unlawfuls just love it when you play along) If you're dealing w/ a good sport, he may only mug you for a toll. It can increase your profit margin by reducing cost & maybe turn out to be some fun interactions.
Or, y'know try & slip by 'em off-plane or some other weaselness
Well... you need a new trade route Vahir, seriously. There are plenty of them, dunno which ship you own, but to fly a hour for 7 milion profit is pure wasting of time.
(f.e. Check FL Companion to find some new routes which might suit you better.)